package com.superman.supermarket.client.composite.refundprocess;

import java.util.Map;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
import com.superman.supermarket.client.composite.IUIModule;
import com.superman.supermarket.client.constant.RefundStatusConstants;

/**
 * 退款流程模块
 * 
 * @author superman
 * @version 2018年8月20日下午11:51:35
 */
public class RefundProcessModule extends Composite implements IUIModule {

	interface RefundProcessModuleUiBinder extends UiBinder<Widget, RefundProcessModule> {
	}

	private static RefundProcessModuleUiBinder uiBinder = GWT.create(RefundProcessModuleUiBinder.class);

	@UiField
	HTML namehtml, timehtml, deschtml, statushtml;

	/**
	 * 构造方法
	 * 
	 * @author superman
	 * @version 2018年8月20日 下午11:51:33
	 */
	public RefundProcessModule() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public Map<String, Object> getData() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setData(Map<String, Object> map) {
		int identity = (int) Double.parseDouble(String.valueOf(map.get("IDENTITY")));
		namehtml.setText(identity == 1 ? "我" : "系统");
		timehtml.setText(String.valueOf(map.get("TIME")));
		deschtml.setText(String.valueOf(map.get("DESC")));

		int status = (int) Double.parseDouble(String.valueOf(map.get("STATE")));
		statushtml.setHTML("状态变更为:&nbsp;:&nbsp;<span style='color:red;'>" + RefundStatusConstants.getDescByStatus(status) + "</span>");
	}

}
